package com.biao.juc;

import java.util.concurrent.locks.LockSupport;

public class Demo05_LockSupport {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            System.out.println("start");
            LockSupport.park();     // 当前线程阻塞
            System.out.println("end");
        });
        thread.start();

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        LockSupport.unpark(thread);     // 唤醒线程
    }
}
